package isanfeng.tuxiaoer.freemarker.custom;

import freemarker.template.SimpleSequence;
import freemarker.template.TemplateMethodModelEx;
import freemarker.template.TemplateModelException;

import java.math.BigDecimal;
import java.util.List;
import java.util.stream.Collectors;

public class SortMethod implements TemplateMethodModelEx {
    @Override
    public Object exec(List args) throws TemplateModelException {
        SimpleSequence arg0 = (SimpleSequence) args.get(0);
        List<BigDecimal> list = arg0.toList();
        return list.stream().sorted().collect(Collectors.toList());
    }
}
